<?php

// legge key
$config = $_POST["config"];

// TEMP
$CODE='G535';

$allowed =  array('txt','TXT');
//$ext = pathinfo($uploadfile, PATHINFO_EXTENSION);
$uploaddir = './data/';
//$uploadfile = $uploaddir . $CODE.".".$ext;
$configfile = $uploaddir . $CODE. ".json";

// if (!move_uploaded_file($_FILES['userfile']['tmp_name'], $uploadfile)) {
// 	json_encode(array('status' => 'error','message'=> 'errore durante upload file!'));
// } else 
if (file_put_contents($configfile, $config)){
	json_encode(array('status' => 'error','message'=> 'errore durante salvataggio config'));
}else{
    json_encode(array('status' => 'success','message'=> 'Configurazione e stemma salvati con successo'));
}


?>